const { View , Text , Button,RadioGroup,Label,Radio} = require("@tarojs/components");
import './CancelRefund.less'
import http from '../../../../utils/http'
import Taro,{useReady} from '@tarojs/taro'
import React, {useState} from 'react'

const cancel=(b)=>{
    Taro.navigateTo({
        url:'/pages/HXM/CancelRefundDetails/CancelRefundDetails?id='+b,
    })
}

function CancelRefund () {
	const [index,setIndex]=useState('')
    const [sum,setSum]=useState()
    const [id,setId]=useState('')
    const [current,setCurrent]=useState(0)
    const [arr,setArr]=useState([])

	useReady(() => {
		setId(Taro.getCurrentInstance().router.params.id)
		http({   //获取我的体检详细
			url:"/getaccomplishphysical",
			data:{
				order_orderId:Taro.getCurrentInstance().router.params.id
			},
			header:{
				'content-type': 'application/json' 
			},
		}).then((res)=>{
			setArr(res[0])
			setSum(res[0].contentPrice+res[0].phy_salePrice)
		})
	})

    const [list,setList]=useState([  //单选框
        {
            value: '买错了',
            text: '买错了',
			checked: true
        },
        {
            value: '计划有变，没时间体检',
            text: '计划有变，没时间体检',
			checked: false
        },
        {
            value: '评价不好',
            text: '评价不好',
			checked: false
        },
        {
            value: '有其他更好的选择',
            text: '有其他更好的选择',
			checked: false
        },
        {
            value:'其他',
            text: '其他',
			checked: false
        }
    ])

    return(
        <View>
		<View className="view1">
			<View className="view1-1">
				<Text>订单编号：{arr.order_orderId}</Text>
			</View>
			<View className="view1-2">
				<View>
					<Text>{arr.order_orderId}</Text>
					<Text>￥{arr.contentPrice}</Text>
				</View>
				<View >
					<Text>{arr.phy_projectName}</Text>
					<Text>￥{arr.phy_salePrice}</Text>
				</View>
				<View>
					<Text style="color:red">合计</Text>
					<Text style="color:red">￥{sum}</Text>
				</View>
			</View>
		</View>
		<View className="view2">
			<View className='radio-list'>
				<RadioGroup>
					{list.map((item, i) => {
					return (
						<Label className='radio-list__label' for={i} key={i}>
						<Radio className='radio-list__radio' value={item.value} checked={item.checked}>{item.text}</Radio>
						</Label>
					)
					})}
				</RadioGroup>
			</View>
		</View>
		
		<View class="view3">
			<Button type="primary" plain="true" onClick={cancel.bind(this,id)} style="color: white;">取消预约并退款</Button>
		</View>
	</View>
    )
}
export default CancelRefund